<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .box{
            width : 200px;
            height: 200px;
            border: 5px solid red;
            padding: 10px;
            margin: 20px;
            background-color: green;
        }
        h3{
            height: 500px;
        }
    </style>
</head>
<body>
    <div class="box"></div>
    <h3>标题1</h3>
    <h3>标题2</h3>
    <h3>标题3</h3>
    <h3>标题4</h3>
    <script>

        var box = document.getElementsByClassName('box')[0];
        console.log((box.clientWidth))
        console.log((box.clientHeight))

        //获取屏幕高度
        console.log(document.documentElement.clientHeight)
        //获取可见区域高度
        console.log(document.body.clientHeight)

        //获取滚动高度
        console.log(document.documentElement.scrollTop)

    </script>
</body>
</html>